/**
 * Created by asus on 2017/4/15.
 */
public class Arr {
     static int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
    public static void main(String[] args) {
        for (int i : arr) {
            System.out.print(i + " ");}
        System.out.println();
        Arr arrs=new Arr ();
        arrs.Remove(5);
        System.out.println();
        arrs.Add(4,5);
        for (int i :arr){
            System.out.print(i +" ");}}
    public void Remove(int a) {
        int test[] = new int[arr.length-1];
        for (int m = 0; m < arr.length; m++) {
            if(arr[m] == a){
                for (int b =m;b < arr.length-1;b++){
                    arr[b] = arr[b+1];
                }}}
        for (int i=0;i<arr.length-1;i++){
            test[i]=arr[i];}
        for (int i : test){
            System.out.print(i+" ");
        }}
    public void Add(int a,int b){
        int Y=arr.length-1;
        for (int X=Y-1 ;X >= a;X--){
            arr[Y]=arr[X];
            Y--;}
        arr[a]=b;}}
